package com.example.safeassistan.my.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.safeassistan.R;
import com.example.safeassistan.my.model.HistoryTaskListModel;
import com.example.safeassistan.train.model.MateralList;

import java.util.List;


public class HistoryTaskListAdapter extends BaseQuickAdapter<HistoryTaskListModel.ResultDTO.RecordsDTO, BaseViewHolder> {

    public HistoryTaskListAdapter(List<HistoryTaskListModel.ResultDTO.RecordsDTO> data) {
        super(R.layout.item_history_task_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, HistoryTaskListModel.ResultDTO.RecordsDTO item) {
        TextView tvType=helper.getView(R.id.tvType);
        ImageView ivStatus=helper.getView(R.id.ivStatus);
        tvType.setText(item.getCheckTypeName());
        helper.setText(R.id.tvCheckCount,item.getScheduleCurrentCount()+"/"+item.getCheckCount());

        helper.setText(R.id.tvCheckTitle,item.getDefName());
        helper.setText(R.id.tvStartTime,"检查开始时间："+item.getStartTime());
        helper.setText(R.id.tvEndTime,"检查结束时间："+item.getEndTime());
        helper.setText(R.id.tvPositionName,"执行岗位："+item.getPositionName());
        switch (item.getDefStatus()){
            case 0:
                //未检查
            case 1:
                //检查中
            case 2:
                //已检查
                ivStatus.setVisibility(View.GONE);
                break;
            case 3:
                ivStatus.setImageResource(R.mipmap.icon_stamp_overdue);
                break;

        }
        if (item.getCheckFrequency()!=null){
            switch (item.getCheckFrequency()){
                case 1:
                    helper.setText(R.id.tvFrequency,"每天");
                    break;
                case 2:
                    helper.setText(R.id.tvFrequency,"每周");
                    break;
                case 3:
                    helper.setText(R.id.tvFrequency,"每月");
                    break;
                case 4:
                    helper.setText(R.id.tvFrequency,"每季");
                    break;
                case 5:
                    helper.setText(R.id.tvFrequency,"每半年");
                    break;
                case 6:
                    helper.setText(R.id.tvFrequency,"每年");
                    break;

            }
        }

    }
}
